package com.gscitysfy.cus.drain.modules.warning.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gscitysfy.cloudfrmwk.assistant.domain.Result;
import com.gscitysfy.cus.drain.annotations.DictTranslation;
import com.gscitysfy.cus.drain.annotations.FieldParam;
import com.gscitysfy.cus.drain.constants.DicConstant;
import com.gscitysfy.cus.drain.modules.warning.entity.DrainWaringSystem;
import com.gscitysfy.cus.drain.modules.warning.entity.DrainWaringWaterloggingSection;
import com.gscitysfy.cus.drain.modules.warning.service.IDrainWaringSystemService;
import com.gscitysfy.cus.drain.modules.warning.service.IDrainWaringWaterloggingSectionService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zhangqiang
 * @since 2022-10-21 17:32:58
 */
@RestController
@RequestMapping("/warning/waterlogging")
public class DrainWaringWaterloggingSectionController {
    @Autowired
    IDrainWaringWaterloggingSectionService drainWaringWaterloggingSectionService;

    /**
     * 获取预警机制列表
     * @return
     */
    @Operation(summary = "获取洪涝路段列表")
    @Parameters({
            @Parameter(required = false, name = "cmType", description = "易涝点类别"),
            @Parameter(required = false, name = "cmName", description = "易涝点名称")
    })
    @DictTranslation({
            @FieldParam(dictType = DicConstant.WATERLOGGING_TYPE, targetField = "cmType")
    })
    @GetMapping("/page")
    public Result<Object> page(@Parameter(hidden = true) Page<DrainWaringWaterloggingSection> page, @Parameter(hidden = true) DrainWaringWaterloggingSection drainWaringWaterloggingSection){
        return drainWaringWaterloggingSectionService.getByPage(page, drainWaringWaterloggingSection);
    }

    @Operation(summary = "获取洪涝路段列表")
    @Parameters({
            @Parameter(required = false, name = "cmType", description = "易涝点类别"),
            @Parameter(required = false, name = "cmName", description = "易涝点名称")
    })
    @DictTranslation({
            @FieldParam(dictType = DicConstant.WATERLOGGING_TYPE, targetField = "cmType")
    })
    @GetMapping("/list")
    public Result<Object> list(@Parameter(hidden = true) DrainWaringWaterloggingSection drainWaringWaterloggingSection){
        return drainWaringWaterloggingSectionService.getList(drainWaringWaterloggingSection);
    }
}
